const express=require("express");
const app=express();
const path=require('path');
const fs=require('fs');

app.get('/',(req,res)=>{
    var fileContent=fs.readFileSync(path.join(__dirname,'/index.html'));
    res.writeHead(200,{'Content-Type':'text/html'});
    res.write(fileContent);
    res.end();
})
app.get('/getimg',(req,res)=>{
    var files=fs.readdirSync(path.join(__dirname,'/images'))
    for(var i=0;i<files.length;i++){
        var fileContent=fs.readFileSync(path.join(__dirname,`/images/${files[i]}`));
        res.write(fileContent);
    }
    res.writeHead(200,{"Content-Type":'image/png'});
    res.end();
})
app.listen(8081);